automation: ensure created are not owned as root
authorDoug Goldstein <cardoe@cardoe.com>
Fri, 3 Aug 2018 14:46:49 +0000 (09:46 -0500)
committerWei Liu <wei.liu2@citrix.com>
Fri, 3 Aug 2018 15:11:22 +0000 (16:11 +0100)
By default the container runs as the root user and since the source tree
is bind mounted into the container, any file is created and owned by the
root user which harms ergonomics when working outside of the container
environment. This maps the root user within the container to the uid of
the user outside of the container so files are not owned by root.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
automation/scripts/containerize

index 7bdfc2155d9b1e4993bd08ad9e1c3e95213ac64c..bf9af589a800b0c9208ee5f587a11702ea861fa8 100755 (executable)
@@ -70,6 +70,7 @@ fi
 # Kick off Docker
 einfo "*** Launching container ..."
 exec docker run \
+    -u $(id -u) \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
     -v "${CONTAINER_PATH}":/build:rw \
     -v "${HOME}/.ssh":/root/.ssh:ro \